$(function(){
	var admin_id = getCookie('admin_id');
	if(!admin_id){
		window.location.replace('login.html');
	}
	$.ajax({
		url: ApiUrl + "/registration?limit="+Page,
        type: 'get',
        dataType: 'JSON',
        success: function(result) {
        	if(result.code == 200){
        		var pageCount = result.data.totalPage;
        		//生成分页按钮
				if(pageCount>5){
					page_icon(1,5,0,pageCount);
				}else{
					page_icon(1,pageCount,0,pageCount);
				}
        	}else{
	    		parent.layer.msg(result.message);
	    		return false;
	    	}
        }
    });
	list_value();
});
function list_value(page){
	if(!page){
		//获取店员列表
	    $.ajax({
			url: ApiUrl + "/registration?limit="+Page,
	        type: 'get',
	        dataType: 'JSON',
	        success: function(result) {
	        	if(result.code == 200){
	        		var html='';
	        		$.each(result.data.list, function(k, v) {
	        			html+='<tr>'
	                            +'<td>'+v.id+'</td>'
	                            +'<td>'+v.admin_name+'</td>';
	                            if(v.type == 1){
			                    	html+='<td>快递损坏</td>';
			                    }else if(v.type == 2){
			                    	html+='<td>自行损坏</td>';
			                    }else{
			                    	html+='<td>其他</td>';
			                    }
                       html+='<td>'+v.memo+'</td>'
                            +'<td>'+v.created_at+'</td>';
	        		});
	        		$("#value").html(html);
	        	}else{
		    		parent.layer.msg(result.message);
		    		return false;
		    	}
	        }
	    });
	}else{
		//$("#value").empty();
		//获取店员列表
	    $.ajax({
			url: ApiUrl + "/registration?limit="+Page+"&page="+page,
	        type: 'get',
	        dataType: 'JSON',
	        success: function(result) {
	        	if(result.code == 200){
	        		var html='';
	        		$.each(result.data.list, function(k, v) {
	        			html+='<tr>'
	                            +'<td>'+v.id+'</td>'
	                            +'<td>'+v.admin_name+'</td>';
	                            if(v.type == 1){
			                    	html+='<td>快递损坏</td>';
			                    }else if(v.type == 2){
			                    	html+='<td>自行损坏</td>';
			                    }else{
			                    	html+='<td>其他</td>';
			                    }
                       html+='<td>'+v.memo+'</td>'
                            +'<td>'+v.created_at+'</td>';
	        		});
	        		$("#value").html(html);
	        	}else{
		    		parent.layer.msg(result.message);
		    		return false;
		    	}
	        }
	    });
	}
	
}